/***************************************************************************
 *   Copyright (C) 2009-2010 by Lasse Liehu                                *
 *   lliehu@kolumbus.fi                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include "loginoperation.h"
#include "googlelogindata.h"

#include <QMetaType>

//BEGIN LoginOperationPrivate
class LoginOperationPrivate
{
    public:
        LoginOperationPrivate(GoogleLoginData& _loginData)
        : loginData(_loginData)
        {
        }

        GoogleLoginData& loginData;
};
//END LoginOperationPrivate

/**
  * @attention This shouldn't be called in two or more threads at the same
  *            time. This function isn't reentrant. Otherwise this whole class
  *            is reentrant, though.
  */
LoginOperation::LoginOperation(GoogleLoginData& loginData, QObject *parent)
: QObject(parent), bd(new LoginOperationPrivate(loginData) )
{
    if (!enumTypesRegistered)
    {
        qRegisterMetaType<Login::Status>("Login::Status");
        qRegisterMetaType<Login::Conclusion>("Login::Conclusion");
        enumTypesRegistered = true;
    }
}

LoginOperation::~LoginOperation()
{
    delete bd;
}

GoogleLoginData& LoginOperation::loginData()
{
    return bd->loginData;
}

bool LoginOperation::enumTypesRegistered = false;
